
function escapeHtml(s){if(!s)return s;var div=document.createElement('div');var text=document.createTextNode(s);div.appendChild(text);return div.innerHTML;}
function unescapeHtml(s){if(!s)return s;var div=document.createElement('div');div.innerHTML=s.replace(/<\/?[^>]+>/gi,'');return div.childNodes[0]?div.childNodes[0].nodeValue:'';}
function onReturn(ev,actionEnter,actionEsc){if(!ev)ev=window.event;if(ev&&ev.keyCode){if(actionEnter&&ev.keyCode==13)actionEnter(ev.srcElement?ev.srcElement:ev.currentTarget);if(actionEsc&&ev.keyCode==27)actionEsc(ev.srcElement?ev.srcElement:ev.currentTarget);}}
function createCookie(name,value,days){var expires="";if(days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));expires="; expires="+date.toGMTString();}
document.cookie=name+"="+value+expires+"; path=/";}
function readCookie(name){var nameEQ=name+"=";var ca=document.cookie.split(';');for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==' ')c=c.substring(1,c.length);if(c.indexOf(nameEQ)==0)return c.substring(nameEQ.length,c.length);}
return null;}
function eraseCookie(name){createCookie(name,"",-1);}
function getAbsoluteTop(e){return e?e.offsetTop+getAbsoluteTop(e.offsetParent):0;}
function getAbsoluteLeft(e){return e?e.offsetLeft+getAbsoluteLeft(e.offsetParent):0;}
function getMousePos(evnt){if(document.all)evnt=event;this.evnt=evnt;var g=(document.all)?event.srcElement:evnt.currentTarget;this.g=g;if(document.all)this.x=evnt.offsetX;else this.x=evnt.layerX-1;if(document.all)this.y=evnt.offsetY;else this.y=evnt.layerY-1;}
function getAbsMousePos(e){if(!e)e=window.event;if(e.pageX||e.pageY){this.x=e.pageX;this.y=e.pageY;}
else if(e.clientX||e.clientY){this.x=e.clientX+document.body.scrollLeft
+document.documentElement.scrollLeft;this.y=e.clientY+document.body.scrollTop
+document.documentElement.scrollTop;}}
function ietruebody(){return(document.compatMode&&document.compatMode!="BackCompat")?document.documentElement:document.body}
function windowWidth(){var w=0;if(typeof window.innerWidth=='number'){w=window.innerWidth;}else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){w=document.documentElement.clientWidth;}else if(document.body&&(document.body.clientWidth||document.body.clientHeight)){w=document.body.clientWidth;}
return w;}
function windowHeight(){var h=0;if(typeof window.innerWidth=='number'){h=window.innerHeight;}else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){h=document.documentElement.clientHeight;}else if(document.body&&(document.body.clientWidth||document.body.clientHeight)){h=document.body.clientHeight;}
return h;}
function formatTxtPos(ra,de){if(typeof ra=="object"){de=ra.de;ra=ra.ra;}
return formatTxtRA(ra)+" "+formatTxtDE(de);}
function formatTxtRA(ra){if(ra<0){ra+=24;}else if(ra>=24){ra-=24;}
var hh=Math.floor(ra).toFixed(0);if(hh.length==1){hh="0"+hh;}
var mm=Math.floor(((ra-Math.floor(ra))*60)).toFixed(0);if(mm.length==1){mm="0"+mm;}
var ss=((ra*60-Math.floor(ra*60))*60).toFixed(2);if(ss.length==4){ss="0"+ss;}
return hh+" "+mm+" "+ss+"";}
function formatTxtDE(de){var deg=Math.floor(Math.abs(de)).toFixed(0);if(deg.length==1){deg="0"+deg;}
if(de<0){deg="-"+deg;}else{deg="+"+deg;}
var mm=Math.floor(Math.abs((Math.abs(de)-Math.floor(Math.abs(de)))*60)).toFixed(0);if(mm.length==1){mm="0"+mm;}
var ss=((Math.abs(de)*60-Math.floor(Math.abs(de*60)))*60).toFixed(1);if(ss.length==3){ss="0"+ss;}
return deg+" "+mm+" "+ss+"";}
function addLoadEvent(func){var oldonload=window.onload;if(typeof window.onload!='function'){window.onload=func;}else{window.onload=function(){if(oldonload)oldonload();func();}}}
var $;if(!$){$=function(s){return document.getElementById(s)};}